package data;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author Michal Hanzlik, Tomas Jiran
 * 
 */
/*
 create table Osoba (
 id_osoby             INT4                 not null,
 jmeno                CHAR(32)             not null,
 prijmeni             CHAR(32)             not null,
 constraint PK_OSOBA primary key (id_osoby)
 );
 */
@Entity
@Table(name = "osoba")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "TYPE_OSOBA", discriminatorType = DiscriminatorType.STRING)
public class Osoba implements Serializable {
    /**
     * id_osoby INT4 not null,
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="osoba_id_osoby_seq")
    @Column(unique=true, nullable=false)
    private int id_osoby = 0;

    /**
     * jmeno CHAR(32) not null,
     */
    @Column(nullable = false)
    private String jmeno;

    /**
     * prijmeni CHAR(32) not null,
     */
    @Column(nullable = false)
    private String prijmeni;

    public Osoba() {
    }

    public Osoba(int ID_o) {
        this.id_osoby = ID_o;
    }

    public Osoba(int ID_o, String jmeno, String prijmeni) {
        this.id_osoby = ID_o;
        this.jmeno = jmeno;
        this.prijmeni = prijmeni;
    }

    public int getId_osoby() {
        return id_osoby;
    }

    public void setJmeno(String jmeno) {
        this.jmeno = jmeno;
    }

    public void setPrijmeni(String prijmeni) {
        this.prijmeni = prijmeni;
    }

    public String getJmeno() {
        return jmeno;
    }

    public String getPrijmeni() {
        return prijmeni;
    }
}